<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>创业者服务首页</title>
		<link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css"/>
		<link rel="stylesheet" href="../css/leftSidebar.css">
		<link rel="stylesheet" href="../fonts/iconfont2.css">

	</head>
	<style type="text/css">
	html,body{height: 100%;}
		.col-xs-12.nav_right{padding: 0;height: 100px;padding-right: 0;margin-right: 0;min-width: 1300px;height: 100px;padding-right: 0;margin-right: 0;padding-left: 160px;}
		#myTab a{color: #7c7c7c;font-size: 15px;}
		#myTab>li.active>a{color: #3f4142; background-color: #fff;}
		.navbar-form{margin-top: 0;}
		.tab_creat .active{color:#cd121d;}
		.table{margin-bottom: 0;}
		div.tab_creat.row{background-color: #fff;}
		.tab_font{padding: 10px 0;}
		.tab_font div,.tab_font td{font-size: 14px;color: #919191;}
		.gongsi_list div.col-xs-2{padding-top:10px;padding-bottom: 10px;text-align: center;}
		.gongsi_list.row{padding: 20px;background-color: #fff;margin-top: 20px;border: 1px solid #ddd;}
		.gongsi_list dd div.col-xs-2{font-size: 14px;color: #4f5051;}
		.btn-success{background-color: #cd121d;border-color:#cd121d;}
		.btn-success:hover{background-color: #f8a719;}
		.btn-success:active{background-color: #f8a719;}
		.btn-success:active:focus{background-color: #f8a719;}
		.btn-success.focus, .btn-success:focus{background-color: #f8a719;}
		.btn{padding: 2px 10px;margin-top: 4px;}
		.row{margin: 0;}
		.btn-default{border-color: #cd121d;color: #cd121d;}
		.list_choose li{width: 10%;float: left;padding: 8px;cursor: pointer;}
		.pagination{float: right !important;}



	</style>
	<body style="background-color: #f2f2f2;">
		<div class="row warp" style="height: 100%;">
			<div class="nav_right_head">
				<a href="../index.html"><img src="../img/roleIndexBg.jpg"  /></a>
			</div>
			<!--左侧导航-->
			<div class="col-xs-2 nav_left">
				<div class="creatNav">创业者服务</div>
				<div class="creatLoginStatus"><img src="../img/avtar.png"><a>您好，创业者</a></div>
				<div class="list-group" style="padding: 0;">
			  	  <a href="cyzfw_index.html" class="list-group-item active"><i class="glyphicon glyphicon-home"></i> 首页</a>
				  <a href="cyzfw_zuche.html" class="list-group-item"><i class="glyphicon glyphicon-plus-sign"></i> 注册项目</a>
				  <a href="cyzfw_myProgress.html" class="list-group-item"><i class="glyphicon glyphicon-folder-open"></i> 我的项目</a>
				  <a href="cyzfw_mynews.html" class="list-group-item"><i class="glyphicon glyphicon-book"></i> 我的消息</a>
					<div class="list-group listAttention">
						<div class="list-group-item" > <span class="caret"></span> 我的关注</div>
						<a href="cyzfw_gz_touziren.html" class="list-group-item"><i class="glyphicon glyphicon-usd"></i> 投资人/机构</a>
						<a href="cyzfw_gz_daoshi.html" class="list-group-item"><i class="glyphicon glyphicon-user"></i> 导师</a>
						<a href="cyzfw_gz_xiangmu.html" class="list-group-item"><i class="glyphicon glyphicon-lock"></i> 项目</a>
					</div>

				</div>
				<div class="backBtn"> <a href="../index.html"><img src="../img/backIndex.png"></a></div>
			</div>
			
			<div class="col-xs-12 nav_right">
					<div class="row" style="margin-top: 10px;">
						<div class="col-xs-10 col-xs-offset-1" >
							<div class="row">
								<ul id="myTab" class="nav nav-pills navbar-left">
									<li class="active"><a href="#home" data-toggle="tab">双创团队</a></li>
									<li><a href="#touzi" data-toggle="tab">投资人</a></li>
				
									<li><a href="#teacher" data-toggle="tab">导师</a></li>
								</ul>
								  <div class="navbar-form navbar-right col-xs-6">
							        <div class="form-group has-error has-feedback">
									  <input type="text" class="form-control" id="keyword" aria-describedby="inputSuccess2Status" placeholder="输入创业项目、投资人、导师、技术名称搜索">
									  <span class=" glyphicon glyphicon-zoom-in form-control-feedback" aria-hidden="true"></span>
									  <span id="inputSuccess2Status" class="sr-only">(success)</span>
									</div>
							      </div>
							</div>
							
							<div id="myTabContent" class="tab-content" style="">
								
								<!--双创团队-->
								<div class="tab-pane fade in active" id="home">
									<div class="tab_creat row tab_font">
										<div class="col-xs-2 text-right" style="padding: 8px 15px;">融资阶段: <span class="caret financingFolded foldedtog" style=""></span> </div>
										<div class="col-xs-10" style="padding: 0;">
											<ul class="list-unstyled clearfix list_choose rongzi">
												<li class="active" chooseId=''>全部</li>
											</ul>
										</div>
									</div>
									
									
									<div class="tab_creat row tab_font">
										<div class="col-xs-2 text-right" style="padding: 8px 15px;">创业领域:<span class="caret bussinessFolded foldedtog"></span></div>
										<div class="col-xs-10" style="padding: 0;">
											<ul class="list-unstyled clearfix list_choose creat_area">
												<li class="active" chooseId=''>全部</li>
													
											</ul>
										</div>
									</div>
									
								
									<div class="tab_creat row tab_font">
										<div class="col-xs-2 text-right" style="padding: 8px 15px;">地区:<span class="caret areaFolded foldedtog"></span></div>
										<div class="col-xs-10" style="padding: 0;">
											<ul class="list-unstyled clearfix list_choose areas">
												<li class="active" chooseId=''>全部</li>
											</ul>
										</div>
									</div>
									
									<div class="tab_creat row tab_font">
										<div class="col-xs-2 text-right" style="padding: 8px 15px;">排序:<span class="caret orderFolded foldedtog"></span></div>
										<div class="col-xs-10" style="padding: 0;">
											<ul class="list-unstyled clearfix list_choose order">
												<li>最近收录</li><li>热度</li>
											</ul>
										</div>
									</div>

									<div class="tab_creat row tab_font">
										
										 <div class="form-group">
										    <label class="col-sm-2 control-label" for="yixing_" style="font-weight: normal;display: inline-block;margin-top: 8px;">是否参加熠星大赛</label>
										    <div class="col-sm-3">
										     <select class="form-control" id="yixing_">
                                                 <option value="1">是</option>
                                                 <option value="0">否</option>
                                             </select>
										    </div>
										    
										     <label class="col-sm-2 control-label" for="creatTime" style="font-weight: normal;display: inline-block;margin-top: 8px;">项目注册时间</label>
										    <div class="col-sm-3">
										     <select class="form-control" id="creatTime">
												 <option value="">全部</option>
												 <option value="2017">2017</option>
												  <option value="2016">2016</option>
												  <option value="2015">2015</option>
												  <option value="2014">2014</option>
												  <option value="2013">2013</option>
											</select>
										    </div>
										    
										<button type="button" class="btn btn-success" id="startSearch" style="width: 70px;margin-left: 50px;">确认</button>

										 </div>

									</div>
									<div class="row gongsi_list">
										<dl style="background-color: #fff;" >
										<dt>
											<div class="row">
												<div class="col-xs-2">双创团队</div>
												<div class="col-xs-2">地区</div>
												<div class="col-xs-2">融资阶段</div>
												<div class="col-xs-2">创业领域</div>
												<div class="col-xs-2">成立时间</div>
												<div class="col-xs-2">操作</div>
											</div>
										</dt>
											<div>
												<div id="company_list">

												</div>
												<ul class="pagination pull-right" id="page">

												</ul>
											</div>

										<!--<dd>
											<div class="row">
												<div class="col-xs-2" style="padding-top:3px ;"><img src="../img/carous.png" style="width: 40px;height: 40px;"/> <a href="cyzfw_myProgress_xq.html" >小橙科技</a></div>
												<div class="col-xs-2">湖北</div>
												<div class="col-xs-2">未融资</div>
												<div class="col-xs-2">生活消费</div>
												<div class="col-xs-2">2015-06-11</div>
												<div class="col-xs-2">7.5</div>
											</div>
										</dd>-->
											
										
										</dl>
									</div>
								</div>
								
								<!--投资人-->
								<div class="tab-pane fade" id="touzi">
									<div class="tab_creat row tab_font">
										<div class="col-xs-2 text-right" style="padding: 8px 15px;">投资领域:<span class="caret tutorInvesetFolded foldedtog"></span></div>
										<div class="col-xs-10" style="padding: 0;">
											<ul class="list-unstyled clearfix list_choose touzhi_area">
												<li class="active" chooseId=''>全部</li>
											</ul>
										</div>
									</div>
									
									
									<div class="tab_creat row tab_font">
										<div class="col-xs-2 text-right" style="padding: 8px 15px;">融资阶段:<span class="caret tutorFinancingFolded foldedtog"></span></div>
										<div class="col-xs-10" style="padding: 0;">
											<ul class="list-unstyled clearfix list_choose rongzi_touzi">
												<li class="active" chooseId=''>全部</li>
													
											</ul>
										</div>
									</div>
									
									<div class="tab_creat row tab_font">
										<div class="col-xs-2 text-right" style="padding: 8px 15px;">地区:<span class="caret tutorAreaFolded foldedtog"></span></div>
										<div class="col-xs-10" style="padding: 0;">
											<ul class="list-unstyled clearfix list_choose areas_touzi">
												<li class="active" chooseId=''>全部</li>
											</ul>
										</div>
									</div>
									
									<div class="tab_creat row tab_font">
										<div class="col-xs-2 text-right" style="padding: 8px 15px;">排序:<span class="caret tutorOrderFolded foldedtog"></span></div>
										<div class="col-xs-10" style="padding: 0;">
											<ul class="list-unstyled clearfix list_choose order_touzi">
												<li>最近收录</li><li>热度</li>
											</ul>
										</div>
										<button type="button" class="btn btn-success col-xs-2 pull-right" id="startSearch_touzi" style="width: 70px;margin-right: 50px;margin-top: -45px;">确认</button>
									</div>
							
									
									<div class="row gongsi_list">
										<dl style="background-color: #fff;">
										<dt>
											<div class="row">
												<div class="col-xs-2">投资机构</div>
												<div class="col-xs-2">投资案例</div>
												<div class="col-xs-2">投资偏好</div>
												<div class="col-xs-2">投资领域</div>
												<div class="col-xs-2">成立时间</div>
												<div class="col-xs-2">操作</div>
											</div>
										</dt>
										<!--<dd>-->
											<!--<div class="row">-->
												<!--<div class="col-xs-2" style="padding-top: 10px;">-->
													<!--<div class="media">-->
													  <!--<div class="media-left media-middle">-->
													    <!--<a href="#">-->
													     <!--<img src="../img/carous.png" style="width: 40px;height: 40px;" alt="../img/defaultAvatar.png"/> -->
													    <!--</a>-->
													  <!--</div>-->
													  <!--<div class="media-body">-->
													    <!--<span>小橙科技</span>-->
													<!---->
													  <!--</div>-->
													<!--</div>-->
													<!---->
												<!--</div>-->
												<!--<div class="col-xs-2">2</div>-->
												<!--<div class="col-xs-2">天使轮</div>-->
												<!--<div class="col-xs-2">电子商务</div>-->
												<!--<div class="col-xs-2">2015-06-11</div>-->
												<!--<div class="col-xs-2"><button class="btn btn-default ">关注</button></div>-->
											<!--</div>-->
										<!---->
										<!--</dd>-->
											<div>
												<div id="touzi_list"></div>

											</div>
											<ul class="pagination pull-right" id="pageInvest">

											</ul>


										</dl>
									</div>
									
									
								</div>
								
								
								
								<!--导师-->
								<div class="tab-pane fade" id="teacher">
									<div class="tab_creat row tab_font">
										<div class="col-xs-2 text-right" style="padding: 8px 15px;">关注领域:<span class="caret tutorAttentionFolded foldedtog"></span></div>
										<div class="col-xs-10" style="padding: 0;">
											<ul class="list-unstyled clearfix list_choose daoshi_gz_area">
												<li class="active" chooseId=''>全部</li>
											</ul>
										</div>
									</div>
									
									
									<div class="tab_creat row tab_font">
										<div class="col-xs-2 text-right" style="padding: 8px 15px;">融资阶段:<span class="caret tutorFusionFolded foldedtog"></span></div>
										<div class="col-xs-10" style="padding: 0;">
											<ul class="list-unstyled clearfix list_choose rongzi_daoshi">
												<li class="active" chooseId=''>全部</li>
													
											</ul>
										</div>
									</div>
									
									<div class="tab_creat row tab_font">
										<div class="col-xs-2 text-right" style="padding: 8px 15px;">地区:<span class="caret tutorRegionFolded foldedtog"></span></div>
										<div class="col-xs-10" style="padding: 0;">
											<ul class="list-unstyled clearfix list_choose areas_daoshi">
												<li class="active" chooseId=''>全部</li>
											</ul>
										</div>
									</div>
									
									<div class="tab_creat row tab_font">
										<div class="col-xs-2 text-right" style="padding: 8px 15px;">排序:<span class="caret tutorSortingFolded foldedtog"></span></div>
										<div class="col-xs-10" style="padding: 0;">
											<ul class="list-unstyled clearfix list_choose order_daoshi">
												<li>最近收录</li><li>热度</li>
											</ul>
										</div>
										<button type="button" class="btn btn-success col-xs-2 pull-right" id="startSearch_daoshi" style="width: 70px;margin-right: 50px;margin-top: -45px;">确认</button>
									</div>
							
									
									<div class="row gongsi_list">
										<dl style="background-color: #fff;">
										<dt>
											<div class="row">
												<div class="col-xs-2">导师</div>
												<div class="col-xs-2">辅导案例</div>
												<div class="col-xs-2">学历</div>
												<div class="col-xs-2">地区</div>
												<div class="col-xs-2">研究领域</div>
												<div class="col-xs-2">操作</div>
											</div>
										</dt>
										<!--<dd>
											<div class="row">
												<div class="col-xs-2" style="padding-top: 10px;">
													<div class="media">
													  <div class="media-left media-middle">
													    <a href="#">
													     <img src="../img/carous.png" style="width: 40px;height: 40px;"/> 
													    </a>
													  </div>
													  <div class="media-body">
													    <span>小橙科技</span>
													
													  </div>
													</div>
												</div>
												<div class="col-xs-2">2</div>
												<div class="col-xs-2">天使轮</div>
												<div class="col-xs-2">电子商务</div>
												<div class="col-xs-2">2015-06-11</div>
												<div class="col-xs-2"><button class="btn btn-default ">关注</button></div>
											</div>
										
										</dd>-->
											<div>
												<div id="daoshi_list"></div>
												<ul class="pagination pull-right" id="pageTutor">

												</ul>
											</div>


										</dl>
									</div>
									
									
									
									
									
									
								</div>
						
							</div>
						</div>
					
				</div>
					
			
		</div>
	</div>
	</body>
	<script src="../js/jquery-2.1.1.min.js"></script>
	<script type="text/javascript" src="../js/bootstrap.min.js" ></script>
	<script type="text/javascript" src="../js/bootstrap-paginator.min.js" ></script>
	<script type="text/javascript" src="../js/public.js"></script>
	<script type="text/javascript">
	var person = JSON.parse(sessionStorage.getItem("person"));
		if (person==''||person==null) {
			$('.creatLoginStatus a').text('您好，请登录！')
//			alert('请先登录')
//			 window.location.href='denglu.html';
		} else{
		var userId = person.userid;
		console.log(userId);
		$('#userId').val(userId)
		}
	
//		$('.gongsi_list').on('click','.btn.btn-default',function(){
//			if ($(this).text()=='关注') {
//				$(this).css({"backgroundColor":"#cd121d","color":'#fff'}).text('已关注')
//			} else{
//				$(this).css({"backgroundColor":"#fff","color":'#cd121d'}).text('关注')
//			}
//		});
	
	
	
//双创团队		
//		融资阶段
		$('.rongzi').on('click','li',function(){
//			if ($(this).hasClass("active")) {
//				$(this).removeClass('active')
//			}else{
//				$(this).addClass('active')
//			}
				$(this).addClass('active').siblings().removeClass('active');
		})
		
	$.ajax({
                type: "get",
                url:"http://114.112.96.184:18080/dict/financingStage",
                async: false,
                error: function(request) {
                    console.log("Connection error");
                },
                success: function(data) {
                	console.log(data)
                   var obj = data.result;
                   var htmls='';
                   for (var i = 0; i < obj.length;i++) {
                   	htmls+= '<li  chooseId="'+ obj[i].id+'">'+ obj[i].value +'</li>'
                   }
                   $('.rongzi').append(htmls);
                }
            });
    foldetoggle('.rongzi li:gt(9)','.financingFolded')


	function foldetoggle(select,selectFun) {
            $(select).hide()
        $(selectFun).on('click',function () {
            $(select).slideToggle()
            $(this).toggleClass('foldedtog');
        })
    }


            
  //创业领域
     $('.creat_area').on('click','li',function(){
//			if ($(this).hasClass("active")) {
//				$(this).removeClass('active')
//			}else{
//				$(this).addClass('active')
//			}
		$(this).addClass('active').siblings().removeClass('active');
		})
		
	$.ajax({
                type: "get",
                url:"http://114.112.96.184:18080/dict/field",
                async: false,
                error: function(request) {
                    console.log("Connection error");
                },
                success: function(data) {
                	console.log(data)
                   var obj = data.result;
                   var htmls='';
                   for (var i = 0; i < obj.length;i++) {
                   	htmls+= '<li  chooseId="'+ obj[i].id+'">'+ obj[i].value +'</li>'
                   }
                   $('.creat_area').append(htmls);
                }
            });
    foldetoggle('.creat_area li:gt(9)','.bussinessFolded');

            //地区
     $('.areas').on('click','li',function(){
//			if ($(this).hasClass("active")) {
//				$(this).removeClass('active')
//			}else{
//				$(this).addClass('active')
//			}
	$(this).addClass('active').siblings().removeClass('active');
		});

	$.ajax({
                type: "get",
                url:"http://114.112.96.184:18080/dict/area",
                async: false,
                error: function(request) {
                    console.log("Connection error");
                },
                success: function(data) {
                	console.log(data);
                   var obj = data.result;
                   var htmls='';
                   for (var i = 0; i < obj.length;i++) {
                   	htmls+= '<li  chooseId="'+ obj[i].id+'">'+ obj[i].value +'</li>'
                   }
                   $('.areas').append(htmls);
                }
            });
    foldetoggle('.areas li:gt(9)','.areaFolded')

            //排序
            $('.order li:eq(0)').addClass('active')
            $('.order').on('click','li',function(){
            	$(this).addClass('active').siblings().removeClass('active');
            })
    foldetoggle('.order li:gt(9)','.orderFolded')
            
            $('#startSearch').on('click',function(){
				 var orderIndex =  $('.order').find('li').filter('.active').index();
				 var obj = {};
				 obj.financingStage=getChooseId('.rongzi');
				 obj.startupField=getChooseId(".creat_area");
				 obj.area=getChooseId('.areas');
				 obj.order=orderIndex;
				 obj.creatTime=$('#creatTime').val();
				obj.keyword=$('#keyword').val();
				obj.userId=userId;
				obj.yixing=$('#yixing_').val();
				var apiUrl ="http://114.112.96.184:18080/view/pbs";
				getpbList(obj,1,10,apiUrl,'#company_list');
            });
            
            
         
            getpbList({'userId':userId},1,10,"http://114.112.96.184:18080/view/pbs",'#company_list');
            //项目列表
            function getpbList(objs,page,pageSize,apiUrl,select){
				objs.index=page;
				objs.size=pageSize;
				$.ajax({
                type: "get",
                data:objs,
                url:apiUrl,
                async: false,
                error: function(request) {
                    console.log("Connection error");
                },
                success: function(data) {
                	console.log(data)
					var pages=Math.ceil(data.result.totalElements/10);

					if(pages<=1){
						$("#page").hide();
					}else{
						$("#page").show();
					}
					var options={
						bootstrapMajorVersion:3,
						currentPage:page,    //当前页数
						numberOfPages:10,
						totalPages:pages,    //所有数据可以显示的页数
						tooltipTitles:function(){
						},
						itemTexts: function (type, page, current) {
							switch (type) {
								case "prev": return "←上一页";
								case "next": return "下一页→";
								case "page": return page;
							}
						},
						shouldShowPage:function(type, page, current){
							switch(type)
							{
								case "first":
								case "last":
									return false;
								default:
									return true;
							}
						},
						onPageClicked:function(event, originalEvent, type,page){
							console.log(page)
							console.log(objs)
							objs.index=page;
							$.ajax({
								type: "get",
								data: objs,
								url: apiUrl,
								async: false,
								error: function (request) {
									console.log("Connection error");
								}, success: function (data) {

									var obj = data.result.content;
									var htmls='';
									for (var i = 0; i < obj.length;i++) {
										var createTime =obj[i].createTime.substring(0,10)
										var attention='';
										var pbName = '';
										pbName=obj[i].pbName;
										if (pbName.length>4){
											pbName=pbName.substring(0,4) + '...'
										}
										if (obj[i].attention==true) {
											attention='取消关注';
										} else{
											attention='关注';
										}
										if(obj[i].userId==userId){
											attention='我的项目';
										}
										htmls+= '<dd>'+
												'<div class="row">'+
												'<div class="col-xs-2" style="padding-top:3px ;"><img src="'+obj[i].logo +'"  onerror="onErrorHandle(this)" style="width: 40px;height: 40px;" /> <a href="cyzfw_myProgress_xq.html?'+obj[i].id +'" pbId="'+ obj[i].id+'" title="'+obj[i].pbName+'">'+ pbName+'</a></div>'+
												'<div class="col-xs-2">'+obj[i].area+'</div>'+
												'<div class="col-xs-2">'+ obj[i].stage+ '</div>'+
												'<div class="col-xs-2">'+ obj[i].field+'</div>'+
												'<div class="col-xs-2">'+ createTime+'</div>'+
												'<div class="col-xs-2 attentionPb" attentionId="'+obj[i].id+'">'+ attention +'</div>'+
												'</div>'+
												'</dd>'
									}
									$(select).html(htmls);

								}
							});

						}
					}
					if(data.result.totalElements>0){
						$("#page").bootstrapPaginator(options);
					}
                   var obj = data.result.content;
                   var htmls='';
                   for (var i = 0; i < obj.length;i++) {
                   	var createTime =obj[i].createTime.substring(0,10)
                   	var attention='';
                   	var pbName = '';
                   	pbName=obj[i].pbName;
                   	if (pbName.length>4){
                   	    pbName=pbName.substring(0,4) + '...'
					}
                   	if (obj[i].attention==true) {
                   		attention='取消关注';
                   	} else{
                   		attention='关注';
                   	}
                   	if(obj[i].userId==userId){
                        attention='我的项目';
					}
                   	htmls+= '<dd>'+
								 '<div class="row">'+
									 '<div class="col-xs-2" style="padding-top:3px ;"><img src="'+obj[i].logo +'"  onerror="onErrorHandle(this)" style="width: 40px;height: 40px;" /> <a href="cyzfw_myProgress_xq.html?'+obj[i].id +'" pbId="'+ obj[i].id+'" title="'+obj[i].pbName+'">'+ pbName+'</a></div>'+
									 '<div class="col-xs-2">'+obj[i].area+'</div>'+
									  '<div class="col-xs-2">'+ obj[i].stage+ '</div>'+
									 '<div class="col-xs-2">'+ obj[i].field+'</div>'+
									 '<div class="col-xs-2">'+ createTime+'</div>'+
									 '<div class="col-xs-2 attentionPb" attentionId="'+obj[i].id+'">'+ attention +'</div>'+
								'</div>'+
							'</dd>'
                   }
                   $(select).html(htmls);
                  
                }
            });
		}



	function getChooseId (select){
             var obj =	$(select).find('li').filter('.active');
              var rongzi_value = "";
              for (var i = 0; i < obj.length;i++) {
              	rongzi_value+= obj[i].getAttribute('chooseid')+ ','
              }
             rongzi_value=rongzi_value.substring(0,rongzi_value.length-1)
             return rongzi_value;
            }
            
            
            
            //投资人
            
            //投资领域部分
              $('.touzhi_area').on('click','li',function(){
//			if ($(this).hasClass("active")) {
//				$(this).removeClass('active')
//			}else{
//				$(this).addClass('active')
//			}
		$(this).addClass('active').siblings().removeClass('active');
		})
		
	$.ajax({
                type: "get",
                url:"http://114.112.96.184:18080/dict/field",
                async: false,
                error: function(request) {
                    console.log("Connection error");
                },
                success: function(data) {
                	console.log(data)
                   var obj = data.result;
                   var htmls='';
                   for (var i = 0; i < obj.length;i++) {
                   	htmls+= '<li  chooseId="'+ obj[i].id+'">'+ obj[i].value +'</li>'
                   }
                   $('.touzhi_area').append(htmls);
                }
            });
    foldetoggle('.touzhi_area li:gt(9)','.tutorInvesetFolded')
             //融资阶段部分

		$('.rongzi_touzi').on('click','li',function(){
//			if ($(this).hasClass("active")) {
//				$(this).removeClass('active')
//			}else{
//				$(this).addClass('active')
//			}
				$(this).addClass('active').siblings().removeClass('active');
		});
		
			$.ajax({
                type: "get",
                url:"http://114.112.96.184:18080/dict/financingStage",
                async: false,
                error: function(request) {
                    console.log("Connection error");
                },
                success: function(data) {
                	console.log(data)
                   var obj = data.result;
                   var htmls='';
                   for (var i = 0; i < obj.length;i++) {
                   	htmls+= '<li  chooseId="'+ obj[i].id+'">'+ obj[i].value +'</li>'
                   }
                   $('.rongzi_touzi').append(htmls);
                }
            });
    foldetoggle('.rongzi_touzi li:gt(9)','.tutorFinancingFolded');
              //地区
    		 $('.areas_touzi').on('click','li',function(){
//			if ($(this).hasClass("active")) {
//				$(this).removeClass('active')
//			}else{
//				$(this).addClass('active')
//			}
	$(this).addClass('active').siblings().removeClass('active');
		});
		
			$.ajax({
                type: "get",
                url:"http://114.112.96.184:18080/dict/area",
                async: false,
                error: function(request) {
                    console.log("Connection error");
                },
                success: function(data) {
                	console.log(data)
                   var obj = data.result;
                   var htmls='';
                   for (var i = 0; i < obj.length;i++) {
                   	htmls+= '<li  chooseId="'+ obj[i].id+'">'+ obj[i].value +'</li>'
                   }
                   $('.areas_touzi').append(htmls);
                }
            });
    foldetoggle('.areas_touzi li:gt(9)','.tutorAreaFolded')
            //排序
            $('.order_touzi li:eq(0)').addClass('active');
            $('.order_touzi').on('click','li',function(){
            	$(this).addClass('active').siblings().removeClass('active');
            });
    foldetoggle('.order_touzi li:gt(9)','.tutorOrderFolded');




             $('#startSearch_touzi').on('click',function(){
				 console.log(getChooseId('.rongzi_touzi')) ;
				 console.log(getChooseId(".touzhi_area"));
				 console.log(getChooseId('.areas_touzi'));
				 var orderIndex =  $('.order_touzi').find('li').filter('.active').index();
				 console.log(orderIndex);
				 var obj = {};
				 obj.financingStage=getChooseId('.rongzi_touzi');
				 obj.field=getChooseId(".touzhi_area");
				 obj.area=getChooseId('.areas_touzi');
				 obj.order=orderIndex;
				 obj.userId=userId;
				 obj.keyword=$('#keyword').val();
				 console.log(obj);
				  apiUrl="http://114.112.96.184:18080/view/invests";
				getInvestList(obj,1,10,apiUrl,'#touzi_list');
            });
             getInvestList({'userId':userId},1,10,"http://114.112.96.184:18080/view/invests",'#touzi_list');
             function getInvestList(objs,page,pageSize,apiUrl,select){
				 objs.index=page;
				 objs.size=pageSize;
				$.ajax({
                type: "get",
                data:objs,
                url:apiUrl,
                async: false,
                error: function(request) {
                    console.log("Connection error");
                },
                success: function(data) {
                	console.log(data)
					var pages=Math.ceil(data.result.totalElements/10);
					if(pages<=1){
						$("#pageInvest").hide();
					}else{
						$("#pageInvest").show();
					}
					var options= {
						bootstrapMajorVersion: 3,
						currentPage: page,    //当前页数
						numberOfPages: 10,
						totalPages: pages,    //所有数据可以显示的页数
						tooltipTitles: function () {
						},
						itemTexts: function (type, page, current) {
							switch (type) {
								case "prev":
									return "←上一页";
								case "next":
									return "下一页→";
								case "page":
									return page;
							}
						},
						shouldShowPage: function (type, page, current) {
							switch (type) {
								case "first":
								case "last":
									return false;
								default:
									return true;
							}
						},
						onPageClicked: function (event, originalEvent, type, page) {
							objs.index=page;
							$.ajax({
								type: "get",
								data: objs,
								url: apiUrl,
								async: false,
								error: function (request) {
									console.log("Connection error");
								},
								success: function (data) {
									var obj = data.result.content;
									var htmls='';
									for (var i = 0; i < obj.length;i++) {
										var createTime =obj[i].createTime.substring(0,10);
										var attention='';
										if (obj[i].attention==true) {
											attention='取消关注'
										} else{
											attention='关注'
										}
										htmls+= '<dd>'+
												'<div class="row">'+
												'<div class="col-xs-2" style="padding-top:3px ;"><img src="'+obj[i].avatar +'" onerror="onErrorHandle(this)" style="width: 40px;height: 40px;"/> <a href="cyzfw_touzhi_xq.html?'+obj[i].userId +'" pbId="'+ obj[i].id+'" >'+ obj[i].realName+'</a></div>'+
												'<div class="col-xs-2">'+obj[i].case+'</div>'+
												'<div class="col-xs-2">'+ obj[i].preference +'</div>'+
												'<div class="col-xs-2">'+ obj[i].field+'</div>'+
												'<div class="col-xs-2">'+ createTime+'</div>'+
												'<div class="col-xs-2 attentionInvest" attentionId="'+obj[i].userId+'">'+ attention +'</div>'+
												'</div>'+
												'</dd>'
									}
									$(select).html(htmls);


								}
							})


						}
					};
					if(data.result.totalElements>0){
						$("#pageInvest").bootstrapPaginator(options);
					}
                   var obj = data.result.content;
                   var htmls='';
                   for (var i = 0; i < obj.length;i++) {
                   	var createTime =obj[i].createTime.substring(0,10);
                   	var attention='';
                   	if (obj[i].attention==true) {
                   		attention='取消关注'
                   	} else{
                   		attention='关注'
                   	}
					   if(obj[i].userId==userId){
						   attention='我';
					   }
                   	htmls+= '<dd>'+
								 '<div class="row">'+
									 '<div class="col-xs-2" style="padding-top:3px ;"><img src="'+obj[i].avatar +'" onerror="onErrorHandle(this)" style="width: 40px;height: 40px;"/> <a href="cyzfw_touzhi_xq.html?'+obj[i].userId +'" pbId="'+ obj[i].id+'" >'+ obj[i].realName+'</a></div>'+
									 '<div class="col-xs-2">'+obj[i].case+'</div>'+
									  '<div class="col-xs-2">'+ obj[i].preference +'</div>'+
									 '<div class="col-xs-2">'+ obj[i].field+'</div>'+
									 '<div class="col-xs-2">'+ createTime+'</div>'+
									 '<div class="col-xs-2 attentionInvest" attentionId="'+obj[i].userId+'">'+ attention +'</div>'+
								'</div>'+
							'</dd>'
                   }
                   $(select).html(htmls);
                  
                }
            });
		}
             
             
             
               //导师
            
            //投资领域部分
              $('.daoshi_gz_area').on('click','li',function(){
//			if ($(this).hasClass("active")) {
//				$(this).removeClass('active')
//			}else{
//				$(this).addClass('active')
//			}
		$(this).addClass('active').siblings().removeClass('active');
		});
		
	          $.ajax({
                type: "get",
                url:"http://114.112.96.184:18080/dict/field",
                async: false,
                error: function(request) {
                    console.log("Connection error");
                },
                success: function(data) {
                	console.log(data)
                   var obj = data.result;
                   var htmls='';
                   for (var i = 0; i < obj.length;i++) {
                   	htmls+= '<li  chooseId="'+ obj[i].id+'">'+ obj[i].value +'</li>'
                   }
                   $('.daoshi_gz_area').append(htmls);
                }
            });
    foldetoggle('.daoshi_gz_area li:gt(9)','.tutorAttentionFolded');
             //融资阶段部分

			$('.rongzi_daoshi').on('click','li',function(){
//			if ($(this).hasClass("active")) {
//				$(this).removeClass('active')
//			}else{
//				$(this).addClass('active')
//			}
				$(this).addClass('active').siblings().removeClass('active');
		});
		
			$.ajax({
                type: "get",
                url:"http://114.112.96.184:18080/dict/financingStage",
                async: false,
                error: function(request) {
                    console.log("Connection error");
                },
                success: function(data) {
                	console.log(data)
                   var obj = data.result;
                   var htmls='';
                   for (var i = 0; i < obj.length;i++) {
                   	htmls+= '<li  chooseId="'+ obj[i].id+'">'+ obj[i].value +'</li>'
                   }
                   $('.rongzi_daoshi').append(htmls);
                }
            });
    foldetoggle('.rongzi_daoshi li:gt(9)','.tutorFusionFolded');
              //地区
  		   $('.areas_daoshi').on('click','li',function(){
//			if ($(this).hasClass("active")) {
//				$(this).removeClass('active')
//			}else{
//				$(this).addClass('active')
//			}
	$(this).addClass('active').siblings().removeClass('active');
		});
		
			$.ajax({
                type: "get",
                url:"http://114.112.96.184:18080/dict/area",
                async: false,
                error: function(request) {
                    console.log("Connection error");
                },
                success: function(data) {
                	console.log(data)
                   var obj = data.result;
                   var htmls='';
                   for (var i = 0; i < obj.length;i++) {
                   	htmls+= '<li  chooseId="'+ obj[i].id+'">'+ obj[i].value +'</li>'
                   }
                   $('.areas_daoshi').append(htmls);
                }
            });
    foldetoggle('.areas_daoshi li:gt(9)','.tutorRegionFolded');
            //排序
            $('.order_daoshi li:eq(0)').addClass('active');
            $('.order_daoshi').on('click','li',function(){
            	$(this).addClass('active').siblings().removeClass('active');
            });

    foldetoggle('.order_daoshi li:gt(9)','.tutorSortingFolded');
             $('#startSearch_daoshi').on('click',function(){
				 var orderIndex =  $('.order_daoshi').find('li').filter('.active').index();
				 console.log(orderIndex);
				 var obj = {};
				 obj.researchField=getChooseId('.daoshi_gz_area');
//				 obj.startupField=getChooseId(".daoshi_area");
				 obj.area=getChooseId('.areas_daoshi');
//				 obj.order=orderIndex;
				 obj.userId=userId;
				 obj.keyword=$('#keyword').val();
				 getTutorList(obj,1,10);
            });

	getTutorList({'userId':userId},1,10);
	function getTutorList(objs,page,pageSize) {
		objs.index=page;
		objs.size=pageSize;
		$.ajax({
			type: "get",
			data:objs,
			url:"http://114.112.96.184:18080/view/tutors",
			async: false,
			error: function(request) {
				console.log("Connection error");
			},
			success: function(data) {
				console.log(data);
				var pages=Math.ceil(data.result.totalElements/10);
				if(pages<=1){
					$("#pageTutor").hide();
				}else{
					$("#pageTutor").show();
				}
				var options= {
					bootstrapMajorVersion: 3,
					currentPage: page,    //当前页数
					numberOfPages: 10,
					totalPages: pages,    //所有数据可以显示的页数
					tooltipTitles: function () {
					},
					itemTexts: function (type, page, current) {
						switch (type) {
							case "prev":
								return "←上一页";
							case "next":
								return "下一页→";
							case "page":
								return page;
						}
					},
					shouldShowPage: function (type, page, current) {
						switch (type) {
							case "first":
							case "last":
								return false;
							default:
								return true;
						}
					},
					onPageClicked: function (event, originalEvent, type, page) {
						objs.index=page;
						$.ajax({
							type: "get",
							data: {'userId': userId, 'index': page, 'size': pageSize},
							url: "http://114.112.96.184:18080/view/tutors",
							async: false,
							error: function (request) {
								console.log("Connection error");
							},
							success: function (data) {
								var obj = data.result.content;
								var htmls='';
								for (var i = 0; i < obj.length;i++) {
									var attention='';
									var createTime='';
									if (obj[i].attention==true) {
										attention='取消关注'
									} else{
										attention='关注'
									}
									if(obj[i].userId==userId){
										attention='我';
									}
									htmls+= '<dd>'+
											'<div class="row">'+
											'<div class="col-xs-2" style="padding-top:3px ;"><img src="'+obj[i].avatar +'" onerror="onErrorHandle(this)" style="width: 40px;height: 40px;"/> <a href="cyzfw_ckds.html?'+ obj[i].id +'">'+ obj[i].realName+'</a></div>'+
											'<div class="col-xs-2">'+obj[i].case+'</div>'+
											'<div class="col-xs-2">'+ obj[i].education+'</div>'+
											'<div class="col-xs-2">'+ obj[i].area+'</div>'+
											'<div class="col-xs-2">'+ obj[i].researchField+'</div>'+
											'<div class="col-xs-2 attentionTutor" attentionId="'+obj[i].id+'">'+ attention +'</div>'+
											'</div>'+
											'</dd>'
								}
								$('#daoshi_list').html(htmls);
							}
						})


					}
				}

				if(data.result.totalElements>0){
					$("#pageTutor").bootstrapPaginator(options);
				}

				var obj = data.result.content;
				var htmls='';
				for (var i = 0; i < obj.length;i++) {
					var attention='';
					var createTime='';
					if (obj[i].attention==true) {
						attention='取消关注'
					} else{
						attention='关注'
					}
					htmls+= '<dd>'+
							'<div class="row">'+
							'<div class="col-xs-2" style="padding-top:3px ;"><img src="'+obj[i].avatar +'" onerror="onErrorHandle(this)" style="width: 40px;height: 40px;"/> <a href="cyzfw_ckds.html?'+ obj[i].id +'">'+ obj[i].realName+'</a></div>'+
							'<div class="col-xs-2">'+obj[i].case+'</div>'+
							'<div class="col-xs-2">'+ obj[i].education+'</div>'+
							'<div class="col-xs-2">'+ obj[i].area+'</div>'+
							'<div class="col-xs-2">'+ obj[i].researchField+'</div>'+
							'<div class="col-xs-2 attentionTutor" attentionId="'+obj[i].id+'">'+ attention +'</div>'+
							'</div>'+
							'</dd>'
				}
				$('#daoshi_list').html(htmls);

			}
		});
	}




            //关注项目
		$(document).on('click','.attentionPb',function () {
			if (person==''||person==null) {
				window.location.href='denglu.html';
				return;
			}
		    if ($(this).text()=='我的项目'){
		        return false;
			}
			var id = $(this).attr('attentionId');

		    if($(this).text()=='关注'){
		        $(this).text('取消关注')
			}else {
                $(this).text('关注')
			}
            attentionPb();
            function attentionPb() {
                $.ajax({
                    type: "post",
					data:{'userId':userId},
                    url:"http://114.112.96.184:18080/auth/attentionPb/"+id,
                    async: false,
                    error: function(request) {
                        console.log("Connection error");
                    },
                    success: function(data) {
                        console.log(data);

                    }
                });
            }

        });


	//关注投资人
	$(document).on('click','.attentionInvest',function () {
		if (person==''||person==null) {
			window.location.href='denglu.html';
			return;
		}
		if ($(this).text()=='我'){
			return false;
		}
		var id = $(this).attr('attentionId');

		if($(this).text()=='关注'){
			$(this).text('取消关注')
		}else {
			$(this).text('关注')
		}
		attentionInvest();
		function attentionInvest() {
			$.ajax({
				type: "post",
				data:{'userId':userId},
				url:"http://114.112.96.184:18080/auth/attentionInvest/"+id,
				async: false,
				error: function(request) {
					console.log("Connection error");
				},
				success: function(data) {
					console.log(data);

				}
			});
		}

	});

	//关注导师
	$(document).on('click','.attentionTutor',function () {
		if (person==''||person==null) {
			window.location.href='denglu.html';
			return;
		}
		if ($(this).text()=='我'){
			return false;
		}
		var id = $(this).attr('attentionId');
		if($(this).text()=='关注'){
			$(this).text('取消关注')
		}else {
			$(this).text('关注')
		}
		attentionTutor();
		function attentionTutor() {
			$.ajax({
				type: "post",
				data:{'userId':userId},
				url:"http://114.112.96.184:18080/auth/attentionTutor/"+id,
				async: false,
				error: function(request) {
					console.log("Connection error");
				},
				success: function(data) {
					console.log(data);
				}
			});
		}

	});

	//图片加载失败情况
	function onErrorHandle(obj){
		obj.src="../img/defaultAvatar.png";
	}
	</script>
</html>
